<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="../../js/easyui/jquery.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../js/easyui/jquery.easyui.min.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="../../js/easyui/themes/default/easyui.css" />
	</head>

	<body>
		h2>Load Dynamic ComboBox Data</h2>
		<p>Drop down the panel and select multiple items.</p>
		<div style="margin:20px 0"></div>

		<input id="cc" class="easyui-combobox" name="language" >
		<input type="button" value="asdasd" onclick="getvalue()" />
	</body>

	<script type="text/javascript">
		$('#cc').combobox({
			url: 'datas.json',
			method: 'get',
			valueField: 'id',
			textField: 'value',
			panelHeight: 'auto',
			multiple: true,
			onSelect: function(row) {
				var target = this;
				var values = $(target).combobox('getValues');
				if (values.length>3&&row.id!='C0099') {
					$.messager.alert('消息','不能超过三个选项');
					$('#cc').combobox('unselect',row.id);
					return;
				}
				if (row.id == 'C0099') {
					for(var i=0;i<values.length;i++){
						if (i==values.length-1) {
							return;
						}
						$('#cc').combobox('unselect',values[i]);
					}
				}else{
					$('#cc').combobox('unselect','C0099');
				}
			}
		});
		
		function getvalue () {
			alert($('#cc').combobox('getTexts'));
		}
	</script>

</html>